using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using BUS;
using Utility;

public partial class Admin_TinhTrangGHUpdate : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
        }
    }
    private void LoadData()
    {
        try
        {
            int iD=int.Parse (Request .QueryString ["iD"].ToString ());
            txt_matinhtranggiaohang .Text =iD.ToString ();
            tbTinhTrangGH tinhtranggiaohang=tbTinhTrangGHBUS.GetByID(iD);
            txt_tentinhtranggiaohang .Text =tinhtranggiaohang .TenTTGH ;
        }
        catch 
        {
            Response .Redirect ("~/Admin/TinhTrangGHDanhSach.aspx");
        }
    }

    protected void btn_sua_Click(object sender, EventArgs e)
    {
        try
        {
            int iD=int.Parse (Request .QueryString ["iD"].ToString ());
            tbTinhTrangGH tinhtranggiaohang=tbTinhTrangGHBUS .GetByID (iD);
            tinhtranggiaohang .TenTTGH =txt_tentinhtranggiaohang .Text ;
            tbTinhTrangGHBUS .Update (tinhtranggiaohang );
        }
        catch
        {
        }
        Response .Redirect ("~/Admin/TinhTrangGHDanhSach.aspx");
        Response .Redirect (Request .RawUrl );
    }
}
